package com.vincent.kdp;

import android.app.Activity;
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.support.annotation.Nullable;

import com.netease.nis.bugrpt.CrashHandler;
import com.netease.nis.bugrpt.user.UserStrategy;
import com.vincent.baseapp.BaseApplication;
import com.vincent.kdp.Activity.GlobalService;
import com.vincent.kdp.ui.other.MainActivity;

import org.xutils.x;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created by Administrator on 2015/9/20.
 */
public class MyApplication extends BaseApplication {

    private HashMap<String, Activity> activityHashMap;
    private List<Activity> activities;

    public HashMap<String, Activity> getActivityHashMap() {
        return activityHashMap;
    }

    public List<Activity> getActivities() {
        return activities;
    }

    private String goBackActivityName;//从相册选择多张图片时，返回的activity名称，每次选择多少图片时都要设置此变量

    public String getGoBackActivityName() {
        return goBackActivityName;
    }

    public void setGoBackActivityName(String goBackActivityName) {
        this.goBackActivityName = goBackActivityName;
    }


    @Override
    public void onCreate() {
        super.onCreate();
        x.Ext.init(this);//Xutils初始化
        activities = new ArrayList<>();
        activityHashMap = new HashMap<>();
        //初始化云捕
        Context appCtx = this.getApplicationContext();
        UserStrategy strategy = new UserStrategy(appCtx);
        strategy.setAnrMonitorStatus(true);
//...在这里设置strategy的属性，在bugrpt初始化时传入
        CrashHandler.init(appCtx, strategy);

        Intent  intent= new Intent(this, GlobalService.class);
        startService(intent);
    }
}
